import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MiniProgramRecordVO, MiniProgramRecordForm, MiniProgramRecordQuery } from '@/api/platform/miniProgramRecord/types';

/**
 * 查询小程序备案信息列表
 * @param query
 * @returns {*}
 */

export const listMiniProgramRecord = (query?: MiniProgramRecordQuery): AxiosPromise<MiniProgramRecordVO[]> => {
  return request({
    url: '/platform/miniProgramRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询小程序备案信息详细
 * @param id
 */
export const getMiniProgramRecord = (id: string | number): AxiosPromise<MiniProgramRecordVO> => {
  return request({
    url: '/platform/miniProgramRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增小程序备案信息
 * @param data
 */
export const addMiniProgramRecord = (data: MiniProgramRecordForm) => {
  return request({
    url: '/platform/miniProgramRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改小程序备案信息
 * @param data
 */
export const updateMiniProgramRecord = (data: MiniProgramRecordForm) => {
  return request({
    url: '/platform/miniProgramRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除小程序备案信息
 * @param id
 */
export const delMiniProgramRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/platform/miniProgramRecord/' + id,
    method: 'delete'
  });
};
